package com.dk.demo.core.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dk.common.utils.CommonUtils;
import com.dk.demo.common.model.DatasetDTO;
import com.dk.demo.core.entity.DataSetEntity;
import com.dk.demo.core.mapper.DatasetMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DatasetService extends ServiceImpl<DatasetMapper, DataSetEntity>{


    @Transactional(rollbackFor = Exception.class)
    public Long save(DatasetDTO datasetDTO) {
        DataSetEntity dataSetEntity = CommonUtils.copyProperties(datasetDTO,DataSetEntity.class);
        saveOrUpdate(dataSetEntity);
        return dataSetEntity.getId();
    }
}
